import java.util.*;

public class Test4 {


    /**
     * 宝石与石头
     *
     * @param jewels
     * @param stones
     * @return
     */
    public static int numJewelsInStones(String jewels, String stones) {
        int count = 0;
        Set<Character> set = new HashSet<>();
        for (int i = 0; i < jewels.length(); i++) {
            set.add(jewels.charAt(i));
        }
        for (int i = 0; i < stones.length(); i++) {
            if (set.contains(stones.charAt(i))) {
                count++;
            }
        }
        return count;
    }

    /**
     * 坏键盘打字
     *
     * @param str1
     * @param str2
     */
    public static void func(String str1, String str2) {
        Set<Character> set1 = new HashSet<>();
        Set<Character> setBroken = new HashSet<>();
        for (char ch : str2.toUpperCase().toCharArray()) {
            if (!set1.contains(ch)) {
                set1.add(ch);
            }
        }
        for (char ch : str1.toUpperCase().toCharArray()) {
            if (!set1.contains(ch) && !setBroken.contains(ch)) {
                setBroken.add(ch);
                System.out.print(ch);
            }
        }
    }

    /**
     * 前K个高频单词
     *
     * @param words
     * @param k
     * @return
     */
    public List<String> topKFrequent(String[] words, int k) {
        // 1.遍历数组，统计每个单词出现的频率
        Map<String, Integer> map = new HashMap<>();
        for (String x : words) {
            if (map.get(x) == null) {
                map.put(x, 1);
            } else {
                map.put(x, map.get(x) + 1);
            }
        }
        // 2.建立小根堆
        PriorityQueue<Map.Entry<String, Integer>> minHeap = new PriorityQueue<>(k, new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
                if (o1.getValue().compareTo(o2.getValue()) == 0){
                    return o2.getKey().compareTo(o1.getKey());
                }
                return o1.getValue().compareTo(o2.getValue());
            }
        });
        // 3.遍历 map 把 数据放入 小根堆
        for (Map.Entry<String, Integer> entry : map.entrySet()){
          if (minHeap.size()<k){
              minHeap.offer(entry);
          }else {
              // 小根堆放满了K个，下一个entry 和堆顶元素进行比较
              Map.Entry<String, Integer> top = minHeap.peek();
              // 堆顶的频率小于当前entry的频率，就出队，然后入队entry
              if (top.getValue().compareTo(entry.getValue()) < 0){
                  minHeap.poll();
                  minHeap.offer(entry);
              }else {
                  // 堆顶元素和当前entry频率相同
                  if (top.getValue().compareTo(entry.getValue()) == 0){
                      // 比较key
                      if (top.getKey().compareTo(entry.getKey()) > 0){
                          minHeap.poll();
                          minHeap.offer(entry);
                      }
                  }
              }
          }
        }
        // 4.此时小根堆中已经有了结果
        List<String> ret = new ArrayList<>();
        for (int i = 0; i < k; i++) {
            String key = minHeap.poll().getKey();
            ret.add(key);
        }
        Collections.reverse(ret);
        return ret;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNextLine()) {
            String str1 = scan.nextLine();
            String str2 = scan.nextLine();
            func(str1, str2);
        }
    }

}

